#ifndef xianshi_H
#define xianshi_H

#include <QMainWindow>

#include <QWidget> 
#include <QPoint>  
#include<vector>  
  #include <QAbstractAnimation>

#include "shuxie.h"
  
using namespace std;  
//线段  
typedef struct myLine{  
    QPoint startPnt;  
    QPoint endPnt;  
}myLine; 
namespace han_zi{
 class hanzi : public QWidget
{
    Q_OBJECT

public:
    hanzi(QWidget* parent,HandWriteRecognizer::Character* pcharacter);
private slots:
 void onCurrentAnimationChanged(QAbstractAnimation *current);
 void onfinished();
 void onframeChanged(int frame);
public:
    virtual ~hanzi();
    
    HandWriteRecognizer::Character* mycharacter;

    void paintCharacter(QSize q_size);//显示字
    void hzAnimation();//笔顺
    void hzAnimation2();
    QPoint startPnt;   //起点  
    QPoint endPnt;     //终点  
    bool isPressed;    //鼠标是否按下  
    bool isBox;
    bool isDispStr;
    bool isLine;//是否画线
    int strokeid;
 protected:
    vector<myLine*> lines; //存放所有的线段 
 private:
    void paintBox();//画杠
     void paintStr();//画文本
     void bhLine(QColor color);
     void paintLine();
     int time_frame;
 protected:
     //继承
     void paintEvent(QPaintEvent* p);
     void mousePressEvent(QMouseEvent *e);
     void mouseMoveEvent(QMouseEvent *e);
     void mouseReleaseEvent(QMouseEvent *e);
};
}
#endif // xianshi_H
